package com.donghu.study;

import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.io.IOException;

@WebServlet(urlPatterns = "/XyY/delete")
public class Userdelete extends HttpServlet {
    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
        String id = req.getParameter("id");

        String sql = "DELETE FROM `user` WHERE id=? AND disabled=0;";//且状态必须为禁用
        JdbcUtils.modify(sql, id);

        resp.sendRedirect("/XyY/user-list.jsp");
    }
}
